#include <bits/stdc++.h>
using namespace std;
#define maxn 20
const int INF = 1<<30;
const double eps = 1e-8;
struct Coordinate {
    double x,y;
};
struct Parabola {
    double a,b;
};

int t,n,m;
double x[maxn],y[maxn];
vector<Parabola> pw;
vector<Coordinate> singlepig;
int ans=INF;

inline Coordinate make_coordinate(double x, double y){
    Coordinate ret;
    ret.x=x; ret.y=y;
    return ret;
}

inline Parabola make_parabola(double a, double b){
    Parabola ret;
    ret.a=a; ret.b=b;
    return ret;
}

bool equal(double x, double y){
    return fabs(x-y) < eps;
}

double get_a(double x1, double x2, double y1, double y2){
    double a = (x2*y1-y2*x1)/(x1*x1*x2-x1*x2*x2);
    return a;
}

double get_b(double x1, double x2, double y1, double y2){
    double b = y1/x1-(x2*y1-y2*x1)/(x1*x2-x2*x2);
    return b;
}

void dfs(int pigid, int linenum, int singlenum){
    if(linenum+singlenum >= ans) return;
    if(pigid >= n){ ans=linenum+singlenum; return; }
    for(int i=0;i<pw.size();i++){
        if(equal(y[pigid], pw[i].a*x[pigid]*x[pigid]+pw[i].b*x[pigid])){
            dfs(pigid+1, linenum, singlenum);
            return;
        }
    }
    for(int i=0;i<singlepig.size();i++){
        if(x[pigid]==singlepig[i].x) continue;
        double a = get_a(x[pigid], singlepig[i].x, y[pigid], singlepig[i].y);
        double b = get_b(x[pigid], singlepig[i].x, y[pigid], singlepig[i].y);
        if(a>=0) continue;
        Coordinate cpig = singlepig[i];
        singlepig.erase(singlepig.begin()+i);
        pw.push_back(make_parabola(a,b));
        dfs(pigid+1, linenum+1, singlenum-1);
        singlepig.insert(singlepig.begin()+i, cpig);
        pw.pop_back();
    }
    singlepig.push_back(make_coordinate(x[pigid],y[pigid]));
    dfs(pigid+1, linenum, singlenum+1);
    singlepig.pop_back();
}

int main(){
    cin>>t;
    for(int tt=0;tt<t;tt++){
        ans=INF;
        pw.clear();
        singlepig.clear();
        
        cin>>n>>m;
        for(int i=0;i<n;i++)
            cin>>x[i]>>y[i];
        
        dfs(0,0,0);
        
        cout<<ans<<endl;
    }
    return 0;
}
